<!DOCTYPE html>
<html>
<head>
    <title></title>
		<#include "/header.html">
    <link rel="stylesheet" href="${request.contextPath}/statics/css/news/ad.css">
    <script src="${request.contextPath}/statics/plugins/ueditor/ueditor.config.js"></script>
    <script src="${request.contextPath}/statics/plugins/ueditor/ueditor.all.js"></script>
    <script src="${request.contextPath}/statics/plugins/ueditor/lang/zh-cn/zh-cn.js"></script>

    <!--<script src="${request.contextPath}/statics/plugins/bootstrap-3.3.7-dist/js/locales/zh.js"></script>-->
    <script src="${request.contextPath}/statics/plugins/bootstrap-3.3.7-dist/js/bootstrap.js"></script>
    <script src="${request.contextPath}/statics/plugins/bootstrap-3.3.7-dist/js/fileinput.min.js"></script>
    <script src="${request.contextPath}/statics/plugins/bootstrap-3.3.7-dist/js/locales/zh.js"></script>
    <link rel="stylesheet" href="${request.contextPath}/statics/plugins/bootstrap-3.3.7-dist/css/fileinput.css">

</head>
<body>
<div id="rrapp" v-cloak>
    <!--<template v-if="viewType === 'dataList'">-->
        <div v-show="showList">
            <div class="form-group">
                <div class="form-group col-sm-2">
                    <select class="form-control" v-model="q.adType" @keyup.enter="query">
                        <option disabled value="">请选择广告类型</option>
                        <option value="1">新闻内容公告页</option>
                        <option value="2">新闻内容内容页</option>
                        <option value="3">出行服务页</option>
                        <option value="4">交警在线页</option>
                    </select>
                    <!--<span>Selected: {{ selected }}</span>-->
                </div>
                <div class="form-group col-sm-2">
                    <select class="form-control" v-model="q.editmode" @keyup.enter="query">
                        <option disabled value="">请选择编辑方式</option>
                        <option value="1">外部链接广告</option>
                        <option value="2">内部公告关联</option>
                        <option value="3">自编辑广告</option>
                    </select>
                </div>

                <div class="form-group col-sm-2">
                    <input type="text" class="form-control" v-model="q.adName" @keyup.enter="query" placeholder="广告名称">
                </div>
                <a class="btn btn-default" @click="query">查询</a>
                <a class="btn btn-warning" @click="reset">重置</a>
            </div>
            <div class="grid-btn">
                <#if shiro.hasPermission("news:ad:save")>
                <a class="btn btn-primary" @click="addExtLinkAD"><i class="fa fa-plus"></i>&nbsp;新增外部链接广告</a>
                </#if>
                <#if shiro.hasPermission("news:ad:save")>
                <a class="btn btn-primary" @click="addInternalNotice"><i class="fa fa-plus"></i>&nbsp;新增内部公告关联</a>
                </#if>
                <#if shiro.hasPermission("news:ad:save")>
                <a class="btn btn-primary" @click="addEditAD"><i class="fa fa-plus"></i>&nbsp;新增自编辑广告</a>
                </#if>
                <#if shiro.hasPermission("news:ad:update")>
                <a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
                </#if>
                <#if shiro.hasPermission("news:ad:delete")>
                <a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
                </#if>
            </div>
            <table id="jqGrid"></table>
            <div id="jqGridPager"></div>
        </div>
    <!--</template>-->


    <!--新增外部链接广告-->
    <div v-show="addExtLinkADView" class="panel panel-default" align="center">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal" style="width:90%!important;">
            <div class="form-group">
                <div class="col-sm-2 control-label" style="width: 10%;">广告类型</div>
                <div class="col-sm-10" style="width: 40%;">
                    <!--<input type="text" class="form-control" width="80%" v-model="ad.type" placeholder="请选择广告类型"/>-->
                    <select class="form-control" v-model="ad.type">
                        <option disabled value="">请选择广告类型</option>
                        <option value="1">新闻内容公告页</option>
                        <option value="2">新闻内容内容页</option>
                        <option value="3">出行服务页</option>
                        <option value="4">交警在线页</option>
                    </select>
                    <!--<span>Selected: {{ selected }}</span>-->
                </div>
                <div class="col-sm-2 control-label" style="width: 10%;">广告名称</div>
                <div class="col-sm-10" style="width: 40%;">
                    <input type="text" class="form-control" width="80%" v-model="ad.name" placeholder="请输入广告名称"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label" style="width: 10%;">广告图片内容</div>
                <div class="col-sm-10" style="width: 90%;">
                    <input type="text" class="form-control col-sm-9" width="40%" v-model="ad.content" placeholder="请输入广告图片内容"/>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-2 control-label" style="width: 10%;">广告图片</div>
                <div class="col-sm-10" style="width: 90%;">
                    <span class="help-block" style="text-align: left; color: red; font-size: 14px">新闻公告页720X360,内容页720X257,出行服务页,交警在线页720x304</span>
                    <input class="form-control" id="myFile1" type="file" name="file" class="fileloading"/>
                    <p class="help-block" style="text-align: left; ">插入要显示的广告图片</p>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-2 control-label" style="width: 10%;"></div>
                <div class="col-sm-10" style="width: 40%;">
                    <input type="hidden" class="form-control" width="80%" v-model="ad.imageurl" placeholder=""/>
                </div>
            </div>


            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
            </div>
        </form>
    </div>

    <!--新增内部公告关联-->
    <div v-show="addInternalNoticeView" class="panel panel-default" align="center">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal" style="width:90%!important;">
            <div class="form-group">
                <div class="col-sm-2 control-label" style="width: 10%;">广告类型</div>
                <div class="col-sm-10" style="width: 40%;">
                    <!--<input type="text" class="form-control" width="80%" v-model="ad.type" placeholder="请选择广告类型"/>-->
                    <select class="form-control" v-model="ad.type">
                        <option disabled value="">请选择广告类型</option>
                        <option value="1">新闻内容公告页</option>
                        <option value="2">新闻内容内容页</option>
                        <option value="3">出行服务页</option>
                        <option value="4">交警在线页</option>
                    </select>
                    <!--<span>Selected: {{ selected }}</span>-->
                </div>
                <div class="col-sm-2 control-label" style="width: 10%;">广告名称</div>
                <div class="col-sm-10" style="width: 40%;">
                    <input type="text" class="form-control" width="80%" v-model="ad.name" placeholder="请输入广告名称"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label" style="width: 10%;">广告图片关联的新闻ID</div>
                <div class="grid-btn" style="width: 90%;">
                    <a id="linkedTopicId" class="btn btn-primary" @click="addlink" style="float: left;">点击获取公众号关联</a>
                    <input type="hidden" v-model="ad.content"/>
                    <!--<a id="linkedTopicId" class="btn btn-primary" @click="addlink" style="float: left;"><i class="fa fa-plus"></i>&nbsp;点击获取公众号关联</a>-->
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-2 control-label" style="width: 10%;">广告图片</div>
                <div class="col-sm-10" style="width: 90%;">
                    <span class="help-block" style="text-align: left; color: red; font-size: 14px">新闻公告页720X360,内容页720X257,出行服务页,交警在线页720x304</span>
                    <input class="form-control" id="myFile2" type="file" name="file" class="fileloading"/>
                    <p class="help-block" style="text-align: left; ">插入要显示的广告图片</p>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-2 control-label" style="width: 10%;"></div>
                <div class="col-sm-10" style="width: 40%;">
                    <input type="hidden" class="form-control" width="80%" v-model="ad.imageurl" placeholder=""/>
                </div>
            </div>


            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
            </div>
        </form>
    </div>

    <!--新增自编辑广告-->
    <div v-show="addEditADView" class="panel panel-default" align="center">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal" style="width:90%!important;">
            <div class="form-group">
                <div class="col-sm-2 control-label" style="width: 10%;">广告类型</div>
                <div class="col-sm-10" style="width: 40%;">
                    <!--<input type="text" class="form-control" width="80%" v-model="ad.type" placeholder="请选择广告类型"/>-->
                    <select class="form-control" v-model="ad.type">
                        <option disabled value="">请选择广告类型</option>
                        <option value="1">新闻内容公告页</option>
                        <option value="2">新闻内容内容页</option>
                        <option value="3">出行服务页</option>
                        <option value="4">交警在线页</option>
                    </select>
                    <!--<span>Selected: {{ selected }}</span>-->
                </div>
                <div class="col-sm-2 control-label" style="width: 10%;">广告名称</div>
                <div class="col-sm-10" style="width: 40%;">
                    <input type="text" class="form-control" width="80%" v-model="ad.name" placeholder="请输入广告名称"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label" style="width: 10%;">发布内容</div>
                <div class="col-sm-10" style="width: 90%;">
                    <script id="editor" type="text/plain" v-model="ad.content"></script>
                    <!-- 实例化编辑器 -->
                    <script type="text/javascript">
                        var ue = UE.getEditor('editor');
                    </script>
                </div>

            </div>

            <div class="form-group">
                <div class="col-sm-2 control-label" style="width: 10%;">广告图片</div>
                <div class="col-sm-10" style="width: 90%;">
                    <span class="help-block" style="text-align: left; color: red; font-size: 14px">新闻公告页720X360,内容页720X257,出行服务页,交警在线页720x304</span>
                    <input class="form-control" id="myFile3" type="file" name="file" class="fileloading"/>
                    <p class="help-block" style="text-align: left; ">插入要显示的广告图片</p>
                </div>
            </div>


            <div class="form-group">
                <div class="col-sm-2 control-label" style="width: 10%;"></div>
                <div class="col-sm-10" style="width: 40%;">
                    <input type="hidden" class="form-control" width="80%" v-model="ad.imageurl" placeholder=""/>
                </div>
            </div>


            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
            </div>
            <br/>
            <br/>
            <br/>
            <br/>
            <br/>
            <br/>
            <br/>
            <br/>
        </form>
    </div>






    <!--内部公告关联链接-->
    <div v-show="topicShowList">
        <div class="form-group">
            <div class="form-group col-sm-2">
                <select class="form-control" placeholder="请选择" v-model="q.channel" @keyup.enter="query">
                    <option disabled value="">请选择</option>
                    <option v-for="channel in channels">{{channel.name}}</option>
                </select>
                <!--<span>Selected: {{ selected }}</span>-->
            </div>
            <a class="btn btn-default" @click="queryTopic">查询</a>
            <a class="btn btn-primary" @click="link"><i class="fa fa-pen cil-square-o"></i>&nbsp;关联</a>
            <a class="btn btn-warning" @click="backToInternalNotice">返回</a>

        </div>
        <table id="jqGrid_topic"></table>
        <div id="jqGridPager_topic"></div>

        <!--<div class="form-group">-->
            <!--<div class="col-sm-2 control-label"></div>-->
            <!--&nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="backToInternalNotice" value="返回"/>-->
        <!--</div>-->

    </div>



</div>
<script >
    var ctx = "${request.contextPath}";
</script>
<script src="${request.contextPath}/statics/js/modules/news/ad.js?_${.now?long}"></script>
</body>
</html>